/**
	区域相关接口
 */
package hard

import (
	. "bc/util"
	"strings"
)

type zone struct {

}
/**
	创建区域
 */
func CreateZone(h map[string]string,json string) (string,error) {

	url := Config.Zstack.ApiUrl + "/v1/zones"
	res,err := Curl.Url(url).Header(h).Body(json).POST()
	return res,err

}
/**
	删除区域
 */
func DeleteZone(uuid string,deleteMode string,h map[string]string) (string,error) {

	url := Config.Zstack.ApiUrl + "/v1/zones/{uuid}?deleteMode={deleteMode}"
	url = strings.Replace(url,"{uuid}",uuid,1)
	url = strings.Replace(url,"{deleteMode}",deleteMode,1)
	res ,err := Curl.Url(url).Header(h).DELETE()
	return res,err

}
/**
	查询区域
 */
func QueryZone(uuid string,h map[string]string) (string,error) {

	url := Config.Zstack.ApiUrl + "/v1/zones/{uuid}"
	url = strings.Replace(url,"{uuid}",uuid,1)
	res,err := Curl.Url(url).Header(h).GET()
	return res,err

}
/**
	更新区域
 */
func UpdateZone(uuid string,h map[string]string,body string) (string,error){

	url := Config.Zstack.ApiUrl + "/v1/zones/{uuid}/actions"
	url = strings.Replace(url,"{uuid}",uuid,1)
	res ,err := Curl.Url(url).Header(h).Body(body).PUT()
	return res,err

}
/**
	改变区域的可用状态
 */
func ChangeZoneState(uuid string,h map[string]string,b string) (string,error){

	url := Config.Zstack.ApiUrl + "/v1/zones/{uuid}/actions"
	url = strings.Replace(url,"{uuid}",uuid,1)
	res ,err := Curl.Url(url).Header(h).Body(b).PUT()
	return res,err

}
var Zone = &zone{}
